import { UpdatePasswordComponent } from './update-password/update-password.component';
import { CanActivate } from '@angular/router';
/**
 * 路由配置
 */
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AuthGuard } from './auth/auth.guard';

import { IndexComponent } from './index/index.component';
import { DetailComponent } from './detail/detail.component';
import { ListComponent } from './list/list.component';
import { ArticleComponent } from './article/article.component';
import { AboutComponent } from './about/about.component';
import { HomeComponent } from './home/home.component';
import { LoginComponent } from './login/login.component';
import { ArticleListComponent } from './article-list/article-list.component'
import { UserComponent } from './user/user.component'
import { cancelRequestAnimationFrame } from 'ng-zorro-antd';


const routes: Routes = [
  {
    path: 'login',
    component: LoginComponent
  },
  {
    path: '',
    component: IndexComponent
  },
  {
    path: 'home',
    component: HomeComponent,
    canActivate: [AuthGuard],
    children:[
      {
        path: 'detail',
        component: DetailComponent
      },
      {
        path: 'article',
        component: ArticleComponent
      },
      {
        path: 'list',
        component: ListComponent
      },
      {
        path: 'about',
        component: AboutComponent
      },
      {
        path: 'article/list',
        component: ArticleListComponent
      },
      {
        path: 'user/password',
        component: UpdatePasswordComponent
      },
      {
        path: 'user/info',
        component: UserComponent
      }
    ]
  },
  {
    path: '**',
    redirectTo: ''
  }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule],
  providers: [AuthGuard]
})

export class AppRoutingModule { }

// export const appRoutingModule = RouterModule.forRoot(routes)
